import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiPage from "../../Page/js/api";
import apiModel from "../../Model/js/api";

export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        fb.addCascade("parentId").setLabel("上级菜单").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(3).setLabel("页面名称").setTips("placeho")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("group").setSpan(3).setLabel("分组").setMaxLength(16)
            .setRules([fb.R.notNull("分组不能为空")])

        fb.addText("key").setSpan(3).setLabel("KEY值").setMaxLength(16)
            .setRules([fb.R.notNull("KEY值不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()

        return fb
    },
    pages:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        fb.addCheckBox("pagesIds").setLabel("页面").setSpan(12)
            .setApi(apiPage.urlChoice).setApiParams({_order:["l"]})
            .setShowInRow(false)

        return fb
    },
    models:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        fb.addCheckBox("modelsIds").setLabel("页面").setSpan(12)
            .setApi(apiModel.urlChoice).setApiParams({_order:["l"]})
            .setShowInRow(false)

        return fb
    }
}